package com.tangmukeji.android.dialog.fragment;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    private HintDialog hintDialog;
    private LoadingDialog loadingDialog;
    private IOSLoadingDialog iosLoadingDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        hintDialog = new HintDialog();
        loadingDialog = new LoadingDialog().setOnTouchOutside(true);
        iosLoadingDialog = new IOSLoadingDialog().setOnTouchOutside(true);

        hintDialog.setOnConfirmClickListener(new HintDialog.HintConfirmCallback() {
            @Override
            public void onClick() {
                hintDialog.dismiss();
            }
        });
        hintDialog.setOnCancelClickListener(new HintDialog.HintCancelCallback() {
            @Override
            public void onClick() {
                hintDialog.dismiss();
            }
        });

        findViewById(R.id.btn_dialog_hint).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                hintDialog.setContent("确定要离开吗？");
                hintDialog.show(getFragmentManager(), "DialogHint");
            }
        });

        findViewById(R.id.btn_dialog_hint_loading).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                loadingDialog.show(getFragmentManager(), "LoadingDialog");
            }
        });
        findViewById(R.id.btn_ios_dialog_hint).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                iosLoadingDialog.show(getFragmentManager(), "IOSLoadingDialog");
            }
        });

    }

}
